/*
 * Copyright (C) 2012 Realtek Semiconductor Corp.
 * All Rights Reserved.
 *
 * This program is the proprietary software of Realtek Semiconductor
 * Corporation and/or its licensors, and only be used, duplicated,
 * modified or distributed under the authorized license from Realtek.
 *
 * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
 * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
 *
 */


#include "app_basic.h"
#include "mib_Cuc_OnuOpticalTransceiversInfo.h"

MIB_TABLE_INFO_T gMibCucOnuOpticalTransInfoTableInfo;
MIB_ATTR_INFO_T  gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ATTR_NUM];
MIB_TABLE_CUC_ONUOPTICALTRANSINFO_T gMibCucOnuOpticalTransInfoDefRow;
MIB_TABLE_OPER_T gMibCucOnuOpticalTransInfoOper;


static GOS_ERROR_CODE omci_mib_cuc_optical_transceiver_oper_reset(UINT32 args_num, ...)
{
    MIB_TABLE_CUC_ONUOPTICALTRANSINFO_T cucOnuOpticalTransInfo;
    CHAR zeroArray[MIB_TABLE_ONUOPTICALTRANSINFO_VENDER_NAME_LEN] = {0};
    char                boaMibVal[OMCI_BOA_MIB_BUFFER_LEN];

    OMCI_LOG(OMCI_LOG_LEVEL_INFO, "Resetting MIB CUC ONU-OPTICAL_TRANS_INFO ME");
    MIB_Default(MIB_TABLE_CUC_ONUOPTICALINFO_INDEX, &cucOnuOpticalTransInfo, sizeof(MIB_TABLE_CUC_ONUOPTICALTRANSINFO_T));
    cucOnuOpticalTransInfo.EntityID       = 0x0000;

    switch(gInfo.ponSpeed)
    {
        case OMCI_PON_SPEED_GPON:
            cucOnuOpticalTransInfo.ModuleType = CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_GPON;
            cucOnuOpticalTransInfo.ModuleSubType = CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_CLASS_B_PULS_C_PLUS;
            cucOnuOpticalTransInfo.TxWavelength = OMCI_TRANSCEIVER_G984_TX_WAVE_LENGTH_VAL;
            cucOnuOpticalTransInfo.RxWavelength = OMCI_TRANSCEIVER_G984_RX_WAVE_LENGTH_VAL;
            break;
        case OMCI_PON_SPEED_XGPON1:
            cucOnuOpticalTransInfo.ModuleType = CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_XGPON;
            cucOnuOpticalTransInfo.ModuleSubType = CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_CLASS_N1_N2A_E1_E2A;
            cucOnuOpticalTransInfo.TxWavelength = OMCI_TRANSCEIVER_G987_TX_WAVE_LENGTH_VAL;
            cucOnuOpticalTransInfo.RxWavelength = OMCI_TRANSCEIVER_G987_RX_WAVE_LENGTH_VAL;
            break;
        case OMCI_PON_SPEED_XGSPON:
            cucOnuOpticalTransInfo.ModuleType = CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_XGSPON;
            cucOnuOpticalTransInfo.ModuleSubType = CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_CLASS_N1_N2A_E1_E2A;
            cucOnuOpticalTransInfo.TxWavelength = OMCI_TRANSCEIVER_G987_TX_WAVE_LENGTH_VAL;
            cucOnuOpticalTransInfo.RxWavelength = OMCI_TRANSCEIVER_G987_RX_WAVE_LENGTH_VAL;
            break;
        default:
            cucOnuOpticalTransInfo.ModuleType = CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_GPON;
            cucOnuOpticalTransInfo.ModuleSubType = CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_CLASS_B_PULS_C_PLUS;
            cucOnuOpticalTransInfo.TxWavelength = OMCI_TRANSCEIVER_G984_TX_WAVE_LENGTH_VAL;
            cucOnuOpticalTransInfo.RxWavelength = OMCI_TRANSCEIVER_G984_RX_WAVE_LENGTH_VAL;
            break;
    }


    //cucOnuOpticalTransInfo.TxWavelength = gInfo.transceiverInfo.waveLength;
    memcpy(cucOnuOpticalTransInfo.VendorName, gInfo.transceiverInfo.vendorName, MIB_TABLE_ONUOPTICALTRANSINFO_VENDER_NAME_LEN);
    memcpy(cucOnuOpticalTransInfo.VendorPN, gInfo.transceiverInfo.vendorPN, MIB_TABLE_ONUOPTICALTRANSINFO_VENDER_PN_LEN);
    memcpy(cucOnuOpticalTransInfo.VendorSN, gInfo.transceiverInfo.vendorSN, MIB_TABLE_ONUOPTICALTRANSINFO_VENDER_SN_LEN);

    if (0 == memcmp(cucOnuOpticalTransInfo.VendorName, &zeroArray, sizeof(zeroArray)))
    {
        /*If Vendor name is default value, check boa setting*/    
        memset(boaMibVal, 0 , OMCI_BOA_MIB_BUFFER_LEN);
        if (GOS_OK == omci_get_boa_mib_value_by_name("BOSA_VENDOR_NAME", boaMibVal))
        {

            memset(cucOnuOpticalTransInfo.VendorName, 0, MIB_TABLE_ONUOPTICALTRANSINFO_VENDER_NAME_LEN+1);
            snprintf(cucOnuOpticalTransInfo.VendorName, MIB_TABLE_ONUOPTICALTRANSINFO_VENDER_NAME_LEN+1, "%s", boaMibVal);
        }


    }

    if (0 == memcmp(cucOnuOpticalTransInfo.VendorPN, &zeroArray, sizeof(zeroArray)))
    {
       /*If Vendor PN is default value, check boa setting*/ 
       memset(boaMibVal, 0 , OMCI_BOA_MIB_BUFFER_LEN);
       if (GOS_OK == omci_get_boa_mib_value_by_name("BOSA_PART_NUMBER", boaMibVal))
       {
           memset(cucOnuOpticalTransInfo.VendorPN, 0, MIB_TABLE_ONUOPTICALTRANSINFO_VENDER_PN_LEN+1);
           snprintf(cucOnuOpticalTransInfo.VendorPN, MIB_TABLE_ONUOPTICALTRANSINFO_VENDER_PN_LEN+1, "%s", boaMibVal);
       }
    }
    
    if (0 == memcmp(cucOnuOpticalTransInfo.VendorSN, &zeroArray, sizeof(zeroArray)))
    {
        /*If Vendor SN is default value, check boa setting*/ 
       memset(boaMibVal, 0 , OMCI_BOA_MIB_BUFFER_LEN);
       if (GOS_OK == omci_get_boa_mib_value_by_name("BOSA_SERIAL_NUMBER", boaMibVal))
       {
           memset(cucOnuOpticalTransInfo.VendorSN, 0, MIB_TABLE_ONUOPTICALTRANSINFO_VENDER_SN_LEN+1);
           snprintf(cucOnuOpticalTransInfo.VendorSN, MIB_TABLE_ONUOPTICALTRANSINFO_VENDER_SN_LEN+1, "%s", boaMibVal);
       }
    }

    GOS_ASSERT(GOS_OK == MIB_Set(MIB_TABLE_CUC_ONUOPTICALINFO_INDEX, &cucOnuOpticalTransInfo, sizeof(MIB_TABLE_CUC_ONUOPTICALTRANSINFO_T)));
    OMCI_MeOperCfg(MIB_TABLE_CUC_ONUOPTICALINFO_INDEX, NULL, &cucOnuOpticalTransInfo, MIB_ADD,
        omci_GetOltAccAttrSet(MIB_TABLE_CUC_ONUOPTICALINFO_INDEX, OMCI_ME_ATTR_ACCESS_SBC), OMCI_MSG_BASELINE_PRI_LOW);


    return GOS_OK;
}


GOS_ERROR_CODE mibTable_init(MIB_TABLE_INDEX tableId)
{

    UINT8 proprietary_mib_cb_bitmask = 0;
    UINT8 isIgnore = 0;
    if(GOS_OK == omci_ignore_mib_table_check(OMCI_ME_CLASS_CUC_OPTICAL_TRANSCEIVERS_INFO, OMCI_ME_CLASS_SUB_DEFAULT, &isIgnore))
    {
        if(isIgnore)
        {
	        OMCI_PRINT("Ignore classId:%d", OMCI_ME_CLASS_CUC_OPTICAL_TRANSCEIVERS_INFO);
            return GOS_FAIL;
        }

    }

    gMibCucOnuOpticalTransInfoTableInfo.Name = "CucOnuOpticalTrasnsInfo";
    gMibCucOnuOpticalTransInfoTableInfo.ShortName = "CUC_ONUOPTTRANSINFO";
    gMibCucOnuOpticalTransInfoTableInfo.Desc = "CUC_ONU Optical transceiver information";
    gMibCucOnuOpticalTransInfoTableInfo.ClassId = OMCI_ME_CLASS_CUC_OPTICAL_TRANSCEIVERS_INFO;
    gMibCucOnuOpticalTransInfoTableInfo.InitType = (UINT32)(OMCI_ME_INIT_TYPE_ONU);
    gMibCucOnuOpticalTransInfoTableInfo.StdType = (UINT32)(OMCI_ME_TYPE_PROPRIETARY);
    gMibCucOnuOpticalTransInfoTableInfo.ActionType = (UINT32)(OMCI_ME_ACTION_GET);
    gMibCucOnuOpticalTransInfoTableInfo.pAttributes = &(gMibCucOnuOpticalTransInfoAttrInfo[0]);

	gMibCucOnuOpticalTransInfoTableInfo.attrNum = MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ATTR_NUM;
	gMibCucOnuOpticalTransInfoTableInfo.entrySize = sizeof(MIB_TABLE_CUC_ONUOPTICALTRANSINFO_T);
	gMibCucOnuOpticalTransInfoTableInfo.pDefaultRow = &gMibCucOnuOpticalTransInfoDefRow;



    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENTITYID_INDEX-MIB_TABLE_FIRST_INDEX].Name = "EntityID";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENTITYID_INDEX-MIB_TABLE_FIRST_INDEX].Desc = "Entity ID";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENTITYID_INDEX-MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENTITYID_INDEX-MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENTITYID_INDEX-MIB_TABLE_FIRST_INDEX].IsIndex = TRUE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENTITYID_INDEX-MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENTITYID_INDEX-MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENTITYID_INDEX-MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENTITYID_INDEX-MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENTITYID_INDEX-MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;

    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].Name = "ModuleType";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].Desc = "Module type";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;

    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_INDEX-MIB_TABLE_FIRST_INDEX].Name = "ModuleSubType";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_INDEX-MIB_TABLE_FIRST_INDEX].Desc = "Module sub-type";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_INDEX-MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_INDEX-MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_INDEX-MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_INDEX-MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_INDEX-MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_INDEX-MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_INDEX-MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;

    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_USED_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].Name = "UsedType";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_USED_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].Desc = "Used type";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_USED_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_USED_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_USED_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_USED_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_USED_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_USED_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_USED_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;

    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENC_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].Name = "EncapType";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENC_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].Desc = "Encapulation Type";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENC_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENC_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENC_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENC_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENC_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENC_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_ENC_TYPE_INDEX-MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;

    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_TX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].Name = "TxWaveLen";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_TX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].Desc = "TX wavelength";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_TX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_TX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_TX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_TX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_TX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_TX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_TX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;

    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].Name = "RxWaveLen";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].Desc = "RX wavelength";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_WAVELENGTH_INDEX-MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;

    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_NAME_INDEX-MIB_TABLE_FIRST_INDEX].Name = "VendorName";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_NAME_INDEX-MIB_TABLE_FIRST_INDEX].Desc = "Vendor name";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_NAME_INDEX-MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_STR;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_NAME_INDEX-MIB_TABLE_FIRST_INDEX].Len = 16;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_NAME_INDEX-MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_NAME_INDEX-MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_NAME_INDEX-MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_CHAR;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_NAME_INDEX-MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_NAME_INDEX-MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;

    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_PN_INDEX-MIB_TABLE_FIRST_INDEX].Name = "VendorPN";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_PN_INDEX-MIB_TABLE_FIRST_INDEX].Desc = "Vendor PN";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_PN_INDEX-MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_STR;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_PN_INDEX-MIB_TABLE_FIRST_INDEX].Len = 16;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_PN_INDEX-MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_PN_INDEX-MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_PN_INDEX-MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_CHAR;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_PN_INDEX-MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_PN_INDEX-MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;

    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_SN_INDEX-MIB_TABLE_FIRST_INDEX].Name = "VendorSN";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_SN_INDEX-MIB_TABLE_FIRST_INDEX].Desc = "Vendor SN";
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_SN_INDEX-MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_STR;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_SN_INDEX-MIB_TABLE_FIRST_INDEX].Len = 16;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_SN_INDEX-MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_SN_INDEX-MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_SN_INDEX-MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_CHAR;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_SN_INDEX-MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibCucOnuOpticalTransInfoAttrInfo[MIB_TABLE_CUC_ONUOPTICALTRANSINFO_RX_VENDOR_SN_INDEX-MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;


    memset(&gMibCucOnuOpticalTransInfoDefRow, 0x00, sizeof(gMibCucOnuOpticalTransInfoDefRow));
    gMibCucOnuOpticalTransInfoDefRow.ModuleType = CUC_ONUOPTICALTRANSINFO_MODULE_TYPE_GPON;
    gMibCucOnuOpticalTransInfoDefRow.ModuleSubType = CUC_ONUOPTICALTRANSINFO_MODULE_SUBTYPE_CLASS_B_PULS_C_PLUS;
    gMibCucOnuOpticalTransInfoDefRow.Usedtype = CUC_ONUOPTICALTRANSINFO_MODULE_USEDTYPE_ONU;
    gMibCucOnuOpticalTransInfoDefRow.EncapsulationType = CUC_ONUOPTICALTRANSINFO_MODULE_ENC_SFP_SFP_PUS;

    memset(&gMibCucOnuOpticalTransInfoOper, 0x0, sizeof(MIB_TABLE_OPER_T));
    gMibCucOnuOpticalTransInfoOper.meOperDrvCfg = NULL;
    gMibCucOnuOpticalTransInfoOper.meOperConnCheck = NULL;
    gMibCucOnuOpticalTransInfoOper.meOperDump = omci_mib_oper_dump_default_handler;
	gMibCucOnuOpticalTransInfoOper.meOperConnCfg = NULL;
    gMibCucOnuOpticalTransInfoOper.meOperCb[PROPRIETARY_MIB_CB_RESET] = omci_mib_cuc_optical_transceiver_oper_reset;
    
	MIB_TABLE_CUC_ONUOPTICALINFO_INDEX = tableId;
    MIB_InfoRegister(tableId, &gMibCucOnuOpticalTransInfoTableInfo, &gMibCucOnuOpticalTransInfoOper);

    proprietary_mib_cb_bitmask = (1 << PROPRIETARY_MIB_CB_RESET);
    MIB_Proprietary_Reg(tableId, proprietary_mib_cb_bitmask);

    return GOS_OK;
}

